﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model.IRepository;
using Model;
using Lib.Query.EntityFramework;
using Lib.Query;

namespace DataAccess.EntityFramework
{
    public class PolicyRepository : IPolicyRepository
    {        
        public IList<T> FindBy<T>(IReadLiteQuery query) where T:Policy
        {
            InsuranceSampleEntities context = new InsuranceSampleEntities();
            context.ContextOptions.ProxyCreationEnabled = false;
            return query.Translate<T>(context.Policies.OfType<T>()).ToList<T>();
        }     
    }
}
